package com.umeng.fb.ui;

import android.app.ListActivity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import com.umeng.fb.a.a;
import com.umeng.fb.a.b;
import com.umeng.fb.b.a;
import com.umeng.fb.b.d;
import com.umeng.fb.b.e;
import com.umeng.fb.util.ActivityStarter;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class FeedbackConversation extends ListActivity
{
  static Context a = null;
  static final String c = FeedbackConversation.class.getSimpleName();
  static boolean d = true;
  public static ExecutorService executorService = Executors.newFixedThreadPool(3);
  boolean b = false;
  private com.umeng.fb.b e;
  private b f;
  private TextView g;
  private EditText h;
  private Button i;
  private a j;

  private void a()
  {
    this.g.setText(getString(e.r(this)));
    this.i.setText(getString(e.s(this)));
  }

  public static void setUserContext(Context paramContext)
  {
    a = paramContext;
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    requestWindowFeature(1);
    setContentView(d.d(this));
    String str = getIntent().getStringExtra("feedback_id");
    if (str != null)
      this.e = com.umeng.fb.util.c.b(this, str);
    try
    {
      this.f = new b(this, this.e);
      setListAdapter(this.f);
      setSelection(-1 + this.f.getCount());
      this.g = ((TextView)findViewById(com.umeng.fb.b.c.m(this)));
      this.h = ((EditText)findViewById(com.umeng.fb.b.c.n(this)));
      this.i = ((Button)findViewById(com.umeng.fb.b.c.o(this)));
      this.i.setOnClickListener(new a(this));
      this.h.requestFocus();
      registerForContextMenu(getListView());
      a();
      if (this.e.b != b.a.d)
      {
        this.h.setEnabled(false);
        this.i.setEnabled(false);
      }
      return;
    }
    catch (Exception localException)
    {
      Log.e(c, "In Feedback class,fail to initialize feedback adapter.");
      finish();
    }
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    if (paramInt == 4)
    {
      if (a != null)
        ActivityStarter.openFeedbackListActivity(a);
      while (true)
      {
        finish();
        return true;
        ActivityStarter.openFeedbackListActivity(this);
      }
    }
    return super.onKeyDown(paramInt, paramKeyEvent);
  }

  protected void onListItemClick(ListView paramListView, View paramView, int paramInt, long paramLong)
  {
    super.onListItemClick(paramListView, paramView, paramInt, paramLong);
    com.umeng.fb.a locala = this.e.a(paramInt);
    if (locala.g == a.a.b)
    {
      if (locala.f != a.b.a)
        break label54;
      ActivityStarter.openSendFeedbackActivity(this, this.e);
      finish();
    }
    return;
    label54: String str = locala.a();
    this.h.setText(str);
    this.h.setEnabled(true);
    this.i.setEnabled(true);
    com.umeng.fb.util.c.a(this, this.e, paramInt);
    this.f.a(this.e);
    this.f.notifyDataSetChanged();
  }

  protected void onStart()
  {
    super.onStart();
    this.j = new a(null);
    IntentFilter localIntentFilter = new IntentFilter();
    localIntentFilter.addAction("postFeedbackFinished");
    localIntentFilter.addAction("RetrieveReplyBroadcast");
    registerReceiver(this.j, localIntentFilter);
  }

  protected void onStop()
  {
    super.onStop();
    unregisterReceiver(this.j);
  }

  private class a extends BroadcastReceiver
  {
    public void onReceive(Context paramContext, Intent paramIntent)
    {
      String str = paramIntent.getStringExtra("feedback_id");
      if (FeedbackConversation.a(FeedbackConversation.this).c.equalsIgnoreCase(str))
      {
        FeedbackConversation.a(FeedbackConversation.this, com.umeng.fb.util.c.b(FeedbackConversation.this, str));
        FeedbackConversation.b(FeedbackConversation.this).a(FeedbackConversation.a(FeedbackConversation.this));
        FeedbackConversation.b(FeedbackConversation.this).notifyDataSetChanged();
      }
      if (FeedbackConversation.a(FeedbackConversation.this).b != b.a.d)
      {
        FeedbackConversation.c(FeedbackConversation.this).setEnabled(false);
        FeedbackConversation.d(FeedbackConversation.this).setEnabled(false);
        return;
      }
      FeedbackConversation.c(FeedbackConversation.this).setEnabled(true);
      FeedbackConversation.d(FeedbackConversation.this).setEnabled(true);
    }
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     com.umeng.fb.ui.FeedbackConversation
 * JD-Core Version:    0.5.2
 */